/**
 * 文字自带边框的实体
 */
ShowTip = cc.Node.extend({
	ctor:function(p,name,pos){
		this._super();
		p.addChild(this,90,TAG_SHOWTIP);
		this.setPosition(pos);
		this.setCascadeOpacityEnabled(true);
		this.init(name);
	},
	init:function(name){
		this.draw = new cc.DrawNode();

		this.addChild(this.draw);
		var content = new cc.LabelTTF(name, gg.fontName, gg.fontSize);
		content.setColor(cc.color(0, 0, 0));
		this.addChild(content);
		var rect = content.getBoundingBox();
		var mr = 10;
		this.draw.drawRect(cc.p(rect.x - mr,rect.y - mr),
				cc.p(rect.x + rect.width + mr,rect.y + rect.height + mr),
				cc.color(126,107,90,200), 2, cc.color(255,255,25,150));

//		if(delay == null){
//		delay = 2;
//		}
//		this.scheduleOnce(this.kill, delay);
		var close =new Button(this, 10, TAG_SHOWTIP_CLOSE, "#button/close.png",this.callback);

		close.setPosition(cc.p(this.draw.x+rect.width*0.5-10,this.draw.y+rect.height*0.5-10));

	},
	callback:function(p){
		var action = gg.flow.flow.action;
		var func = cc.callFunc(this.actionDone, this);	
		switch(p.getTag()){
		case TAG_SHOWTIP_CLOSE:
			this.kill();
			break;
		}
	},
	kill:function(){
		var seq = cc.sequence(cc.callFunc(function(){
			this.removeFromParent(true);
			gg.flow.next();

		}, this));
		this.runAction(seq);
	}

})